package com.example.dryyzx.dao;

import com.example.dryyzx.entity.NursingLevel;
import com.example.dryyzx.entity.User;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

import java.util.ArrayList;
import java.util.List;

public interface NursingLevelMapper {
    @Delete({
        "delete from nursing_level",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into nursing_level (id, level, ",
        "enable, description, ",
        "content_id1, fre1, ",
        "time1, content_id2, ",
        "fre2, time2, ",
        "content_id3, fre3, ",
        "time3, content_id4, ",
        "fre4, time4, ",
        "content_id5, fre5, ",
        "time5, content_id6, ",
        "fre6, time6)",
        "values (#{id,jdbcType=INTEGER}, #{level,jdbcType=VARCHAR}, ",
        "#{enable,jdbcType=BIT}, #{description,jdbcType=VARCHAR}, ",
        "#{contentId1,jdbcType=INTEGER}, #{fre1,jdbcType=VARCHAR}, ",
        "#{time1,jdbcType=INTEGER}, #{contentId2,jdbcType=INTEGER}, ",
        "#{fre2,jdbcType=VARCHAR}, #{time2,jdbcType=INTEGER}, ",
        "#{contentId3,jdbcType=INTEGER}, #{fre3,jdbcType=VARCHAR}, ",
        "#{time3,jdbcType=INTEGER}, #{contentId4,jdbcType=INTEGER}, ",
        "#{fre4,jdbcType=VARCHAR}, #{time4,jdbcType=INTEGER}, ",
        "#{contentId5,jdbcType=INTEGER}, #{fre5,jdbcType=VARCHAR}, ",
        "#{time5,jdbcType=INTEGER}, #{contentId6,jdbcType=INTEGER}, ",
        "#{fre6,jdbcType=VARCHAR}, #{time6,jdbcType=INTEGER})"
    })
    int insert(NursingLevel record);

    @InsertProvider(type=NursingLevelSqlProvider.class, method="insertSelective")
    int insertSelective(NursingLevel record);

    @Select({
        "select",
        "id, level, enable, description, content_id1, fre1, time1, content_id2, ",
        "fre2, time2, content_id3, fre3, time3, content_id4, fre4, time4, ",
        "content_id5, fre5, time5, content_id6, fre6, time6",
        "from nursing_level",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="level", property="level", jdbcType=JdbcType.VARCHAR),
        @Result(column="enable", property="enable", jdbcType=JdbcType.BIT),
        @Result(column="description", property="description", jdbcType=JdbcType.VARCHAR),
        @Result(column="content_id1", property="contentId1", jdbcType=JdbcType.INTEGER),
        @Result(column="fre1", property="fre1", jdbcType=JdbcType.VARCHAR),
        @Result(column="time1", property="time1", jdbcType=JdbcType.INTEGER),
        @Result(column="content_id2", property="contentId2", jdbcType=JdbcType.INTEGER),
        @Result(column="fre2", property="fre2", jdbcType=JdbcType.VARCHAR),
        @Result(column="time2", property="time2", jdbcType=JdbcType.INTEGER),
        @Result(column="content_id3", property="contentId3", jdbcType=JdbcType.INTEGER),
        @Result(column="fre3", property="fre3", jdbcType=JdbcType.VARCHAR),
        @Result(column="time3", property="time3", jdbcType=JdbcType.INTEGER),
        @Result(column="content_id4", property="contentId4", jdbcType=JdbcType.INTEGER),
        @Result(column="fre4", property="fre4", jdbcType=JdbcType.VARCHAR),
        @Result(column="time4", property="time4", jdbcType=JdbcType.INTEGER),
        @Result(column="content_id5", property="contentId5", jdbcType=JdbcType.INTEGER),
        @Result(column="fre5", property="fre5", jdbcType=JdbcType.VARCHAR),
        @Result(column="time5", property="time5", jdbcType=JdbcType.INTEGER),
        @Result(column="content_id6", property="contentId6", jdbcType=JdbcType.INTEGER),
        @Result(column="fre6", property="fre6", jdbcType=JdbcType.VARCHAR),
        @Result(column="time6", property="time6", jdbcType=JdbcType.INTEGER)
    })
    NursingLevel selectByPrimaryKey(Integer id);

    @Select({
            "select",
            "count(*)",
            "from nursing_level",
            "where level = #{level,jdbcType=VARCHAR}"
    })
   int countByLevel(@Param("level")String level);

    @Select({
            "select",
            "count(*)",
            "from nursing_level"
    })
    int countLevels();

    @Select({
            "select",
            "id, level, enable, description, content_id1, fre1, time1, content_id2, ",
            "fre2, time2, content_id3, fre3, time3, content_id4, fre4, time4, ",
            "content_id5, fre5, time5, content_id6, fre6, time6",
            "from nursing_level",
            "limit #{arg0,jdbcType=INTEGER} offset #{arg1,jdbcType=INTEGER}"
    })
    @Results({
            @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
            @Result(column="level", property="level", jdbcType=JdbcType.VARCHAR),
            @Result(column="enable", property="enable", jdbcType=JdbcType.BIT),
            @Result(column="description", property="description", jdbcType=JdbcType.VARCHAR),
            @Result(column="content_id1", property="contentId1", jdbcType=JdbcType.INTEGER),
            @Result(column="fre1", property="fre1", jdbcType=JdbcType.VARCHAR),
            @Result(column="time1", property="time1", jdbcType=JdbcType.INTEGER),
            @Result(column="content_id2", property="contentId2", jdbcType=JdbcType.INTEGER),
            @Result(column="fre2", property="fre2", jdbcType=JdbcType.VARCHAR),
            @Result(column="time2", property="time2", jdbcType=JdbcType.INTEGER),
            @Result(column="content_id3", property="contentId3", jdbcType=JdbcType.INTEGER),
            @Result(column="fre3", property="fre3", jdbcType=JdbcType.VARCHAR),
            @Result(column="time3", property="time3", jdbcType=JdbcType.INTEGER),
            @Result(column="content_id4", property="contentId4", jdbcType=JdbcType.INTEGER),
            @Result(column="fre4", property="fre4", jdbcType=JdbcType.VARCHAR),
            @Result(column="time4", property="time4", jdbcType=JdbcType.INTEGER),
            @Result(column="content_id5", property="contentId5", jdbcType=JdbcType.INTEGER),
            @Result(column="fre5", property="fre5", jdbcType=JdbcType.VARCHAR),
            @Result(column="time5", property="time5", jdbcType=JdbcType.INTEGER),
            @Result(column="content_id6", property="contentId6", jdbcType=JdbcType.INTEGER),
            @Result(column="fre6", property="fre6", jdbcType=JdbcType.VARCHAR),
            @Result(column="time6", property="time6", jdbcType=JdbcType.INTEGER)
    })
    List<NursingLevel> selectByLimitAndOffset(Integer arg0, Integer arg1);

    @Select({
            "select",
            "id, level, enable, description, content_id1, fre1, time1, content_id2, ",
            "fre2, time2, content_id3, fre3, time3, content_id4, fre4, time4, ",
            "content_id5, fre5, time5, content_id6, fre6, time6",
            "from nursing_level",
            "where level = #{level,jdbcType=VARCHAR}",
            "limit #{arg0,jdbcType=INTEGER} offset #{arg1,jdbcType=INTEGER}"
    })
    @Results({
            @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
            @Result(column="level", property="level", jdbcType=JdbcType.VARCHAR),
            @Result(column="enable", property="enable", jdbcType=JdbcType.BIT),
            @Result(column="description", property="description", jdbcType=JdbcType.VARCHAR),
            @Result(column="content_id1", property="contentId1", jdbcType=JdbcType.INTEGER),
            @Result(column="fre1", property="fre1", jdbcType=JdbcType.VARCHAR),
            @Result(column="time1", property="time1", jdbcType=JdbcType.INTEGER),
            @Result(column="content_id2", property="contentId2", jdbcType=JdbcType.INTEGER),
            @Result(column="fre2", property="fre2", jdbcType=JdbcType.VARCHAR),
            @Result(column="time2", property="time2", jdbcType=JdbcType.INTEGER),
            @Result(column="content_id3", property="contentId3", jdbcType=JdbcType.INTEGER),
            @Result(column="fre3", property="fre3", jdbcType=JdbcType.VARCHAR),
            @Result(column="time3", property="time3", jdbcType=JdbcType.INTEGER),
            @Result(column="content_id4", property="contentId4", jdbcType=JdbcType.INTEGER),
            @Result(column="fre4", property="fre4", jdbcType=JdbcType.VARCHAR),
            @Result(column="time4", property="time4", jdbcType=JdbcType.INTEGER),
            @Result(column="content_id5", property="contentId5", jdbcType=JdbcType.INTEGER),
            @Result(column="fre5", property="fre5", jdbcType=JdbcType.VARCHAR),
            @Result(column="time5", property="time5", jdbcType=JdbcType.INTEGER),
            @Result(column="content_id6", property="contentId6", jdbcType=JdbcType.INTEGER),
            @Result(column="fre6", property="fre6", jdbcType=JdbcType.VARCHAR),
            @Result(column="time6", property="time6", jdbcType=JdbcType.INTEGER)
    })
    List<NursingLevel> selectLevelByLimitAndOffset(Integer arg0, Integer arg1,String level);

    @UpdateProvider(type=NursingLevelSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(NursingLevel record);

    @UpdateProvider(type=NursingLevelSqlProvider.class, method="setNull1")
    int setNull1(NursingLevel record);

    @UpdateProvider(type=NursingLevelSqlProvider.class, method="setNull2")
    int setNull2(NursingLevel record);

    @UpdateProvider(type=NursingLevelSqlProvider.class, method="setNull3")
    int setNull3(NursingLevel record);

    @UpdateProvider(type=NursingLevelSqlProvider.class, method="setNull4")
    int setNull4(NursingLevel record);

    @UpdateProvider(type=NursingLevelSqlProvider.class, method="setNull5")
    int setNull5(NursingLevel record);

    @UpdateProvider(type=NursingLevelSqlProvider.class, method="setNull6")
    int setNull6(NursingLevel record);

    @Update({
        "update nursing_level",
        "set level = #{level,jdbcType=VARCHAR},",
          "enable = #{enable,jdbcType=BIT},",
          "description = #{description,jdbcType=VARCHAR},",
          "content_id1 = #{contentId1,jdbcType=INTEGER},",
          "fre1 = #{fre1,jdbcType=VARCHAR},",
          "time1 = #{time1,jdbcType=INTEGER},",
          "content_id2 = #{contentId2,jdbcType=INTEGER},",
          "fre2 = #{fre2,jdbcType=VARCHAR},",
          "time2 = #{time2,jdbcType=INTEGER},",
          "content_id3 = #{contentId3,jdbcType=INTEGER},",
          "fre3 = #{fre3,jdbcType=VARCHAR},",
          "time3 = #{time3,jdbcType=INTEGER},",
          "content_id4 = #{contentId4,jdbcType=INTEGER},",
          "fre4 = #{fre4,jdbcType=VARCHAR},",
          "time4 = #{time4,jdbcType=INTEGER},",
          "content_id5 = #{contentId5,jdbcType=INTEGER},",
          "fre5 = #{fre5,jdbcType=VARCHAR},",
          "time5 = #{time5,jdbcType=INTEGER},",
          "content_id6 = #{contentId6,jdbcType=INTEGER}",
          "fre6 = #{fre6,jdbcType=VARCHAR},",
          "time6 = #{time6,jdbcType=INTEGER},",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(NursingLevel record);
}